<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   深度学习与计算机视觉系列(1)_基础介绍  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/21801.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466461069: Accept with keywords: (title(0.333333333333):社区,计算机,基础,数盟,深度学习,视觉, topn(0.4):社区,点对点,数盟,深度学习,数组,视觉,赋值,内积,计算机,结果,Python,元素,个子,大写,计算,文章,酱紫,数据,向量,图片,函数,python,矩阵,空格,字符串,乘法,逻辑,距离,人工智能,序列).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    深度学习与计算机视觉系列(1)_基础介绍
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    深度学习与计算机视觉系列(1)_基础介绍 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,67] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/ai">
       人工智能
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/21801.html">
          深度学习与计算机视觉系列(1)_基础介绍
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          1,705 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/ai" rel="category tag">
          人工智能
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <div class="article_content" id="article_content">
        <div class="markdown_views">
         <p>
          作者：
          <a href="http://blog.csdn.net/han_xiaoyang?viewmode=contents">
           寒小阳
          </a>
          &amp;&amp;
          <a href="http://blog.csdn.net/longxinchen_ml?viewmode=contents">
           龙心尘
          </a>
          <br/>
          出处：
          <br/>
          <a href="http://blog.csdn.net/han_xiaoyang/article/details/49876119">
           http://blog.csdn.net/han_xiaoyang/article/details/49876119
          </a>
          <br/>
          <a href="http://blog.csdn.net/longxinchen_ml/article/details/49963327">
           http://blog.csdn.net/longxinchen_ml/article/details/49963327
          </a>
          <br/>
          声明：版权所有，转载请注明出处，谢谢。
         </p>
         <h2 id="1背景">
          <p name="t0">
          </p>
          1.背景
         </h2>
         <p>
          <a href="http://library.kiwix.org/wikipedia_zh_all/A/html/%E8%AE%A1/%E7%AE%97/%E6%9C%BA/%E8%A7%86/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89.html">
           计算机视觉
          </a>
          /
          <a href="https://en.wikipedia.org/wiki/Computer_vision">
           computer vision
          </a>
          是一个火了N年的topic。持续化升温的原因也非常简单：在搜索/影像内容理解/医学应用/地图识别等等领域应用太多，大家都有一个愿景『让计算机能够像人一样去”看”一张图片，甚至”读懂”一张图片』。
         </p>
         <p>
          有几个比较重要的计算机视觉任务，比如图片的分类,物体识别，物体定位于检测等等。而近年来的
          <a href="https://en.wikipedia.org/wiki/Deep_learning">
           神经网络/深度学习
          </a>
          使得上述任务的准确度有了非常大的提升。加之最近做了几个不大不小的计算机视觉上的项目，爱凑热闹的博主自然不打算放过此领域，也边学边做点笔记总结，写点东西，写的不正确的地方，欢迎大家提出和指正。
         </p>
         <h2 id="2基础知识">
          <p name="t1">
          </p>
          2.基础知识
         </h2>
         <p>
          为了简单易读易懂，这个系列中绝大多数的代码都使用python完成。这里稍微介绍一下python和Numpy/Scipy(
          <strong>
           python中的科学计算包
          </strong>
          )的一些基础。
         </p>
         <h3 id="21-python基础">
          <p name="t2">
          </p>
          2.1 python基础
         </h3>
         <p>
          python是一种长得像伪代码，具备高可读性的编程语言。
          <br/>
          优点挺多：可读性相当好，写起来也简单，所想立马可以转为实现代码，且社区即为活跃，可用的package相当多；缺点：效率一般。
         </p>
         <h4 id="211-基本数据类型">
          <p name="t3">
          </p>
          2.1.1 基本数据类型
         </h4>
         <p>
          最常用的有数值型(Numbers),布尔型(Booleans)和字符串(String)三种。
         </p>
         <ul>
          <li>
           数值型(Numbers)
          </li>
         </ul>
         <p>
          可进行简单的运算，如下：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f239b984825391" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            x = 5
print type(x) # Prints "&lt;type 'int'&gt;"
print x       # Prints "5"
print x + 1   # 加; prints "6"
print x - 1   # 减; prints "4"
print x * 2   # 乘; prints "10"
print x ** 2  # 幂; prints "25"
x += 1  #自加
print x  # Prints "6"
x *= 2  #自乘
print x  # Prints "12"
y = 2.5
print type(y) # Prints "&lt;type 'float'&gt;"
print y, y + 1, y * 2, y ** 2 # Prints "2.5 3.5 5.0 6.25"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f239b984825391-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f239b984825391-14">
                 14
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f239b984825391-1">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-2">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  type
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "&lt;type 'int'&gt;"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f239b984825391-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "5"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 加; prints "6"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f239b984825391-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  -
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 减; prints "4"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 乘; prints "10"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f239b984825391-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 幂; prints "25"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-8">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +=
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #自加
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f239b984825391-9">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "6"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-10">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *=
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #自乘
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f239b984825391-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "12"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-12">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2.5
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f239b984825391-13">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  type
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "&lt;type 'float'&gt;"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f239b984825391-14">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "2.5 3.5 5.0 6.25"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0244 seconds] -->
         <p>
          PS：python中没有x++ 和 x– 操作
         </p>
         <ul>
          <li>
           布尔型(Booleans)
          </li>
         </ul>
         <p>
          包含True False和常见的与或非操作
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23ad928287605" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            t = True
f = False
print type(t) # Prints "&lt;type 'bool'&gt;"
print t and f # 逻辑与; prints "False"
print t or f  # 逻辑或; prints "True"
print not t   # 逻辑非; prints "False"
print t != f  # XOR; prints "True"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23ad928287605-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23ad928287605-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23ad928287605-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23ad928287605-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23ad928287605-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23ad928287605-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23ad928287605-7">
                 7
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23ad928287605-1">
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-t">
                  True
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23ad928287605-2">
                 <span class="crayon-v">
                  f
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-t">
                  False
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23ad928287605-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  type
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "&lt;type 'bool'&gt;"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23ad928287605-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  t
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  and
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  f
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 逻辑与; prints "False"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23ad928287605-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  t
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  or
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  f
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 逻辑或; prints "True"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23ad928287605-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  not
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 逻辑非; prints "False"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23ad928287605-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  !=
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  f
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # XOR; prints "True"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0029 seconds] -->
         <p>
         </p>
         <ul>
          <li>
           字符串型(String)
          </li>
         </ul>
         <p>
          字符串可以用单引号/双引号/三引号声明
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23b4083444717" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            hello = 'hello'   
world = "world"   
print hello       # Prints "hello"
print len(hello)  # 字符串长度; prints "5"
hw = hello + ' ' + world  # 字符串连接
print hw  # prints "hello world"
hw2015 = '%s %s %d' % (hello, world, 2015)  # 格式化字符串
print hw2015  # prints "hello world 2015"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23b4083444717-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23b4083444717-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23b4083444717-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23b4083444717-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23b4083444717-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23b4083444717-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23b4083444717-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23b4083444717-8">
                 8
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23b4083444717-1">
                 <span class="crayon-v">
                  hello
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'hello'
                 </span>
                 <span class="crayon-h">
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23b4083444717-2">
                 <span class="crayon-v">
                  world
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  "world"
                 </span>
                 <span class="crayon-h">
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23b4083444717-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  hello
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "hello"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23b4083444717-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  len
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  hello
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 字符串长度; prints "5"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23b4083444717-5">
                 <span class="crayon-v">
                  hw
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  hello
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  ' '
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  world
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 字符串连接
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23b4083444717-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  hw
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # prints "hello world"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23b4083444717-7">
                 <span class="crayon-v">
                  hw2015
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  '%s %s %d'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  hello
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  world
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2015
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 格式化字符串
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23b4083444717-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  hw2015
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # prints "hello world 2015"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0122 seconds] -->
         <p>
          字符串对象有很有有用的函数：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23be951940041" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            s = "hello"
print s.capitalize()  # 首字母大写; prints "Hello"
print s.upper()       # 全大写; prints "HELLO"
print s.rjust(7)      # 以7为长度右对齐，左边补空格; prints "  hello"
print s.center(7)     # 居中补空格; prints " hello "
print s.replace('l', '(ell)')  # 字串替换;prints "he(ell)(ell)o"
print '  world '.strip()  # 去首位空格; prints "world"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23be951940041-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23be951940041-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23be951940041-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23be951940041-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23be951940041-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23be951940041-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23be951940041-7">
                 7
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23be951940041-1">
                 <span class="crayon-v">
                  s
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  "hello"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23be951940041-2">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  s
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  capitalize
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 首字母大写; prints "Hello"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23be951940041-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  s
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  upper
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 全大写; prints "HELLO"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23be951940041-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  s
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  rjust
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 以7为长度右对齐，左边补空格; prints "  hello"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23be951940041-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  s
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  center
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 居中补空格; prints " hello "
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23be951940041-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  s
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  replace
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'l'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  '(ell)'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 字串替换;prints "he(ell)(ell)o"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23be951940041-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  '  world '
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  strip
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 去首位空格; prints "world"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0121 seconds] -->
         <p>
         </p>
         <h4 id="212-基本容器">
          <p name="t4">
          </p>
          2.1.2 基本容器
         </h4>
         <ul>
          <li>
           <strong>
            <em>
             列表/List
            </em>
           </strong>
          </li>
         </ul>
         <p>
          和数组类似的一个东东，不过可以包含不同类型的元素，同时大小也是可以调整的。
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23c9449059050" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            xs = [3, 1, 2]   # 创建
print xs, xs[2]  # Prints "[3, 1, 2] 2"
print xs[-1]     # 第-1个元素，即最后一个
xs[2] = 'foo'    # 下标从0开始，这是第3个元素
print xs         # 可以有不同类型，Prints "[3, 1, 'foo']"
xs.append('bar') # 尾部添加一个元素
print xs         # Prints 
x = xs.pop()     # 去掉尾部的元素
print x, xs      # Prints "bar [3, 1, 'foo']"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23c9449059050-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23c9449059050-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23c9449059050-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23c9449059050-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23c9449059050-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23c9449059050-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23c9449059050-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23c9449059050-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23c9449059050-9">
                 9
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23c9449059050-1">
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 创建
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23c9449059050-2">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[3, 1, 2] 2"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23c9449059050-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  -
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 第-1个元素，即最后一个
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23c9449059050-4">
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'foo'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 下标从0开始，这是第3个元素
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23c9449059050-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 可以有不同类型，Prints "[3, 1, 'foo']"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23c9449059050-6">
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  append
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'bar'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 尾部添加一个元素
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23c9449059050-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23c9449059050-8">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  pop
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 去掉尾部的元素
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23c9449059050-9">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  xs
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "bar [3, 1, 'foo']"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0130 seconds] -->
         <p>
          列表最常用的操作有：
          <br/>
          <strong>
           切片/slicing
          </strong>
          <br/>
          即取子序列/一部分元素，如下：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23d4230030694" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            nums = range(5)    # 从1到5的序列
print nums         # Prints "[0, 1, 2, 3, 4]"
print nums[2:4]    # 下标从2到4-1的元素 prints "[2, 3]"
print nums[2:]     # 下标从2到结尾的元素
print nums[:2]     # 从开头到下标为2-1的元素  [0, 1]
print nums[:]      # 恩，就是全取出来了
print nums[:-1]    # 从开始到第-1个元素(最后的元素)
nums[2:4] = [8, 9] # 对子序列赋值
print nums         # Prints "[0, 1, 8, 8, 4]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23d4230030694-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23d4230030694-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23d4230030694-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23d4230030694-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23d4230030694-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23d4230030694-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23d4230030694-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23d4230030694-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23d4230030694-9">
                 9
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23d4230030694-1">
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  range
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 从1到5的序列
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23d4230030694-2">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[0, 1, 2, 3, 4]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23d4230030694-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 下标从2到4-1的元素 prints "[2, 3]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23d4230030694-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 下标从2到结尾的元素
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23d4230030694-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 从开头到下标为2-1的元素  [0, 1]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23d4230030694-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 恩，就是全取出来了
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23d4230030694-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-o">
                  -
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 从开始到第-1个元素(最后的元素)
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23d4230030694-8">
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 对子序列赋值
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23d4230030694-9">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[0, 1, 8, 8, 4]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0160 seconds] -->
         <p>
          <strong>
           循环/loops
          </strong>
          <br/>
          即遍历整个list，做一些操作，如下：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23e0238541749" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            animals = ['cat', 'dog', 'monkey']
for animal in animals:
    print animal
# 依次输出 "cat", "dog", "monkey"，每个一行.
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23e0238541749-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23e0238541749-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23e0238541749-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23e0238541749-4">
                 4
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23e0238541749-1">
                 <span class="crayon-v">
                  animals
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'dog'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'monkey'
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23e0238541749-2">
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  animal
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  animals
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23e0238541749-3">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23e0238541749-4">
                 <span class="crayon-c">
                  # 依次输出 "cat", "dog", "monkey"，每个一行.
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0016 seconds] -->
         <p>
          可以用enumerate取出元素的同时带出下标
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f23ea599202417" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            animals = [&lt;span class="hljs-string"&gt;'cat'&lt;/span&gt;, &lt;span class="hljs-string"&gt;'dog'&lt;/span&gt;, &lt;span class="hljs-string"&gt;'monkey'&lt;/span&gt;]
&lt;span class="hljs-keyword"&gt;for&lt;/span&gt; idx, animal &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; enumerate(animals):
    &lt;span class="hljs-keyword"&gt;print&lt;/span&gt; &lt;span class="hljs-string"&gt;'#%d: %s'&lt;/span&gt; % (idx + &lt;span class="hljs-number"&gt;1&lt;/span&gt;, animal)
&lt;span class="hljs-comment"&gt;# 输出 "#1: cat", "#2: dog", "#3: monkey"，一个一行。&lt;/span&gt;
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f23ea599202417-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23ea599202417-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f23ea599202417-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f23ea599202417-4">
                 4
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f23ea599202417-1">
                 <span class="crayon-v">
                  animals
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-string"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-string"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-s">
                  'dog'
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-string"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-s">
                  'monkey'
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23ea599202417-2">
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-keyword"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  idx
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-keyword"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  enumerate
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  animals
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f23ea599202417-3">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-keyword"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-v">
                  print
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-string"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-s">
                  '#%d: %s'
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  idx
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-number"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-v">
                  span
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f23ea599202417-4">
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-e">
                  span
                 </span>
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-s">
                  "hljs-comment"
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-p">
                  # 输出 "#1: cat", "#2: dog", "#3: monkey"，一个一行。&lt;/span&gt;
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0241 seconds] -->
         <p>
         </p>
         <ul class="pre-numbering">
          <li>
           1
          </li>
          <li>
           2
          </li>
          <li>
           3
          </li>
          <li>
           4
          </li>
         </ul>
         <p>
          <strong>
           List comprehension
          </strong>
          <br/>
          这个相当相当相当有用，在很长的list生成过程中，效率完胜for循环：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f240f365690165" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            # for 循环
nums = [0, 1, 2, 3, 4]
squares = []
for x in nums:
    squares.append(x ** 2)
print squares   # Prints [0, 1, 4, 9, 16]

# list comprehension
nums = [0, 1, 2, 3, 4]
squares = [x ** 2 for x in nums]
print squares   # Prints [0, 1, 4, 9, 16]
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f240f365690165-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f240f365690165-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f240f365690165-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f240f365690165-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f240f365690165-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f240f365690165-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f240f365690165-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f240f365690165-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f240f365690165-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f240f365690165-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f240f365690165-11">
                 11
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f240f365690165-1">
                 <span class="crayon-c">
                  # for 循环
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f240f365690165-2">
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f240f365690165-3">
                 <span class="crayon-v">
                  squares
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f240f365690165-4">
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f240f365690165-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  squares
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  append
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f240f365690165-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  squares
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints [0, 1, 4, 9, 16]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f240f365690165-7">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f240f365690165-8">
                 <span class="crayon-c">
                  # list comprehension
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f240f365690165-9">
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f240f365690165-10">
                 <span class="crayon-v">
                  squares
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f240f365690165-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  squares
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints [0, 1, 4, 9, 16]
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0197 seconds] -->
         <p>
          你猜怎么着，list comprehension也是可以加多重条件的：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f241f974260255" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            nums = [0, 1, 2, 3, 4]
even_squares = [x ** 2 for x in nums if x % 2 == 0]
print even_squares  # Prints "[0, 4, 16]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f241f974260255-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f241f974260255-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f241f974260255-3">
                 3
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f241f974260255-1">
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f241f974260255-2">
                 <span class="crayon-v">
                  even_squares
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  nums
                 </span>
                 <span class="crayon-st">
                  if
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  ==
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f241f974260255-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  even_squares
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[0, 4, 16]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0108 seconds] -->
         <p>
         </p>
         <ul>
          <li>
           <strong>
            <em>
             字典/Dict
            </em>
           </strong>
           <br/>
           和Java中的Map一样的东东，用于存储key-value对：
          </li>
         </ul>
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f242b972622142" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            d = {'cat': 'cute', 'dog': 'furry'}  # 创建
print d['cat']       # 根据key取出value
print 'cat' in d     # 判断是否有'cat'这个key
d['fish'] = 'wet'    # 添加元素
print d['fish']      # Prints "wet"
# print d['monkey']  # KeyError: 'monkey'非本字典的key
print d.get('monkey', 'N/A')  # 有key返回value，无key返回"N/A"
print d.get('fish', 'N/A')    # prints "wet"
del d['fish']        # 删除某个key以及对应的value
print d.get('fish', 'N/A') # prints "N/A"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f242b972622142-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f242b972622142-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f242b972622142-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f242b972622142-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f242b972622142-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f242b972622142-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f242b972622142-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f242b972622142-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f242b972622142-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f242b972622142-10">
                 10
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f242b972622142-1">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  {
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'cute'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'dog'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'furry'
                 </span>
                 <span class="crayon-sy">
                  }
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 创建
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f242b972622142-2">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 根据key取出value
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f242b972622142-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 判断是否有'cat'这个key
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f242b972622142-4">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-s">
                  'fish'
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'wet'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 添加元素
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f242b972622142-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-s">
                  'fish'
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "wet"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f242b972622142-6">
                 <span class="crayon-c">
                  # print d['monkey']  # KeyError: 'monkey'非本字典的key
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f242b972622142-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  get
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'monkey'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'N/A'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 有key返回value，无key返回"N/A"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f242b972622142-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  get
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'fish'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'N/A'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # prints "wet"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f242b972622142-9">
                 <span class="crayon-r">
                  del
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-s">
                  'fish'
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 删除某个key以及对应的value
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f242b972622142-10">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  get
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'fish'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'N/A'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # prints "N/A"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0209 seconds] -->
         <p>
         </p>
         <ul>
          <li>
           对应list的那些操作，你在dict里面也能找得到：
          </li>
         </ul>
         <p>
          <strong>
           循环/loops
          </strong>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2436650124334" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            # for循环
d = {'person': 2, 'cat': 4, 'spider': 8}
for animal in d:
    legs = d[animal]
    print 'A %s has %d legs' % (animal, legs)
# Prints "A person has 2 legs", "A spider has 8 legs", "A cat has 4 legs"

# 通过iteritems
d = {'person': 2, 'cat': 4, 'spider': 8}
for animal, legs in d.iteritems():
    print 'A %s has %d legs' % (animal, legs)
# Prints "A person has 2 legs", "A spider has 8 legs", "A cat has 4 legs"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2436650124334-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2436650124334-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2436650124334-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2436650124334-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2436650124334-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2436650124334-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2436650124334-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2436650124334-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2436650124334-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2436650124334-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2436650124334-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2436650124334-12">
                 12
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2436650124334-1">
                 <span class="crayon-c">
                  # for循环
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2436650124334-2">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  {
                 </span>
                 <span class="crayon-s">
                  'person'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'spider'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  }
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2436650124334-3">
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  animal
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2436650124334-4">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  legs
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2436650124334-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'A %s has %d legs'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  legs
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2436650124334-6">
                 <span class="crayon-c">
                  # Prints "A person has 2 legs", "A spider has 8 legs", "A cat has 4 legs"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2436650124334-7">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2436650124334-8">
                 <span class="crayon-c">
                  # 通过iteritems
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2436650124334-9">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  {
                 </span>
                 <span class="crayon-s">
                  'person'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'cat'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'spider'
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  }
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2436650124334-10">
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  legs
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  iteritems
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2436650124334-11">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'A %s has %d legs'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  animal
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  legs
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2436650124334-12">
                 <span class="crayon-c">
                  # Prints "A person has 2 legs", "A spider has 8 legs", "A cat has 4 legs"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0135 seconds] -->
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2440093118740" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            # Dictionary comprehension
nums = [0, 1, 2, 3, 4]
even_num_to_square = {x: x ** 2 for x in nums if x % 2 == 0}
print even_num_to_square  # Prints "{0: 0, 2: 4, 4: 16}"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2440093118740-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2440093118740-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2440093118740-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2440093118740-4">
                 4
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2440093118740-1">
                 <span class="crayon-c">
                  # Dictionary comprehension
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2440093118740-2">
                 <span class="crayon-v">
                  nums
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2440093118740-3">
                 <span class="crayon-v">
                  even_num_to_square
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  {
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  nums
                 </span>
                 <span class="crayon-st">
                  if
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  ==
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  }
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2440093118740-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  even_num_to_square
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "{0: 0, 2: 4, 4: 16}"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0150 seconds] -->
         <p>
         </p>
         <ul>
          <li>
           <strong>
            <em>
             元组/turple
            </em>
           </strong>
           <br/>
           本质上说，还是一个list，只不过里面的每个元素都是一个两元组对。
          </li>
         </ul>
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f244a780005457" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            d = {(x, x + 1): x for x in range(10)}  # 创建
t = (5, 6)       # Create a tuple
print type(t)    # Prints "&lt;type 'tuple'&gt;"
print d[t]       # Prints "5"
print d[(1, 2)]  # Prints "1"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f244a780005457-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f244a780005457-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f244a780005457-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f244a780005457-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f244a780005457-5">
                 5
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f244a780005457-1">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  {
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  range
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  }
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 创建
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f244a780005457-2">
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Create a tuple
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f244a780005457-3">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  type
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "&lt;type 'tuple'&gt;"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f244a780005457-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  t
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "5"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f244a780005457-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "1"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0148 seconds] -->
         <p>
         </p>
         <h4 id="213-函数">
          <p name="t5">
          </p>
          2.1.3 函数
         </h4>
         <p>
          用def可以定义一个函数：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2454400363950" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            def sign(x):
    if x &gt; 0:
        return 'positive'
    elif x &lt; 0:
        return 'negative'
    else:
        return 'zero'

for x in [-1, 0, 1]:
    print sign(x)
# Prints "negative", "zero", "positive"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2454400363950-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2454400363950-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2454400363950-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2454400363950-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2454400363950-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2454400363950-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2454400363950-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2454400363950-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2454400363950-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2454400363950-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2454400363950-11">
                 11
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2454400363950-1">
                 <span class="crayon-r">
                  def
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  sign
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2454400363950-2">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  if
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2454400363950-3">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  return
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'positive'
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2454400363950-4">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  elif
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &lt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2454400363950-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  return
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'negative'
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2454400363950-6">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  else
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2454400363950-7">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  return
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'zero'
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2454400363950-8">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2454400363950-9">
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  -
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2454400363950-10">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  sign
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2454400363950-11">
                 <span class="crayon-c">
                  # Prints "negative", "zero", "positive"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0141 seconds] -->
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f245f176319417" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            def hello(name, loud=False):
    if loud:
        print 'HELLO, %s' % name.upper()
    else:
        print 'Hello, %s!' % name

hello('Bob') # Prints "Hello, Bob"
hello('Fred', loud=True)  # Prints "HELLO, FRED!"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f245f176319417-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f245f176319417-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f245f176319417-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f245f176319417-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f245f176319417-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f245f176319417-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f245f176319417-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f245f176319417-8">
                 8
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f245f176319417-1">
                 <span class="crayon-r">
                  def
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  hello
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  name
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  loud
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-t">
                  False
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f245f176319417-2">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  if
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  loud
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f245f176319417-3">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'HELLO, %s'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  name
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  upper
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f245f176319417-4">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  else
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f245f176319417-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'Hello, %s!'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  name
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f245f176319417-6">
                </div>
                <div class="crayon-line" id="crayon-57686b86f245f176319417-7">
                 <span class="crayon-e">
                  hello
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'Bob'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "Hello, Bob"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f245f176319417-8">
                 <span class="crayon-e">
                  hello
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'Fred'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  loud
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-t">
                  True
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "HELLO, FRED!"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0111 seconds] -->
         <p>
         </p>
         <ul>
          <li>
           类/Class
          </li>
         </ul>
         <p>
          python里面的类定义非常的直接和简洁：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2468540526660" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            class Greeter:

    # Constructor
    def __init__(self, name):
        self.name = name  # Create an instance variable

    # Instance method
    def greet(self, loud=False):
        if loud:
            print 'HELLO, %s!' % self.name.upper()
        else:
            print 'Hello, %s' % self.name

g = Greeter('Fred')  # Construct an instance of the Greeter class
g.greet()            # Call an instance method; prints "Hello, Fred"
g.greet(loud=True)   # Call an instance method; prints "HELLO, FRED!"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2468540526660-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2468540526660-16">
                 16
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2468540526660-1">
                 <span class="crayon-t">
                  class
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  Greeter
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-3">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Constructor
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-4">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-r">
                  def
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  __init__
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-r">
                  self
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  name
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-r">
                  self
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  name
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  name
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Create an instance variable
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-6">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-7">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Instance method
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-8">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-r">
                  def
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  greet
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-r">
                  self
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  loud
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-t">
                  False
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-9">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  if
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  loud
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-10">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'HELLO, %s!'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-r">
                  self
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  name
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  upper
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-11">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  else
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-12">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'Hello, %s'
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  %
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-r">
                  self
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-i">
                  name
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-13">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-14">
                 <span class="crayon-v">
                  g
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  Greeter
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'Fred'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Construct an instance of the Greeter class
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2468540526660-15">
                 <span class="crayon-v">
                  g
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  greet
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Call an instance method; prints "Hello, Fred"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2468540526660-16">
                 <span class="crayon-v">
                  g
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  greet
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  loud
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-t">
                  True
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Call an instance method; prints "HELLO, FRED!"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0472 seconds] -->
         <p>
         </p>
         <h3 id="22numpy基础">
          <p name="t6">
          </p>
          2.2.NumPy基础
         </h3>
         <p>
          NumPy是Python的科学计算的一个核心库。它提供了一个高性能的多维数组(矩阵)对象，可以完成在其之上的很多操作。很多机器学习中的计算问题，把数据vectorize之后可以进行非常高效的运算。
         </p>
         <h4 id="221-数组">
          <p name="t7">
          </p>
          2.2.1 数组
         </h4>
         <p>
          一个NumPy数组是一些类型相同的元素组成的类矩阵数据。用list或者层叠的list可以初始化：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2473718794703" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

a = np.array([1, 2, 3])  # 一维Numpy数组
print type(a)            # Prints "&lt;type 'numpy.ndarray'&gt;"
print a.shape            # Prints "(3,)"
print a[0], a[1], a[2]   # Prints "1 2 3"
a[0] = 5                 # 重赋值
print a                  # Prints "[5, 2, 3]"

b = np.array([[1,2,3],[4,5,6]])   # 二维Numpy数组
print b.shape                     # Prints "(2, 3)"
print b[0, 0], b[0, 1], b[1, 0]   # Prints "1 2 4"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2473718794703-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2473718794703-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2473718794703-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2473718794703-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2473718794703-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2473718794703-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2473718794703-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2473718794703-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2473718794703-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2473718794703-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2473718794703-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2473718794703-12">
                 12
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2473718794703-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2473718794703-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2473718794703-3">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 一维Numpy数组
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2473718794703-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  type
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "&lt;type 'numpy.ndarray'&gt;"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2473718794703-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  shape
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "(3,)"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2473718794703-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "1 2 3"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2473718794703-7">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 重赋值
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2473718794703-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[5, 2, 3]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2473718794703-9">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2473718794703-10">
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 二维Numpy数组
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2473718794703-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  shape
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "(2, 3)"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2473718794703-12">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "1 2 4"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0248 seconds] -->
         <p>
          生成一些特殊的Numpy数组(矩阵)时，我们有特定的函数可以调用：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f247f708239289" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

a = np.zeros((2,2))  # 全0的2*2 Numpy数组
print a              # Prints "[[ 0.  0.]
                     #          [ 0.  0.]]"

b = np.ones((1,2))   # 全1 Numpy数组
print b              # Prints "[[ 1.  1.]]"

c = np.full((2,2), 7) # 固定值Numpy数组
print c               # Prints "[[ 7.  7.]
                      #          [ 7.  7.]]"

d = np.eye(2)        # 2*2 对角Numpy数组
print d              # Prints "[[ 1.  0.]
                     #          [ 0.  1.]]"

e = np.random.random((2,2)) # 2*2 的随机Numpy数组
print e                     # 随机输出
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-17">
                 17
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f247f708239289-18">
                 18
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f247f708239289-19">
                 19
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f247f708239289-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-3">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  zeros
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 全0的2*2 Numpy数组
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 0.  0.]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 0.  0.]]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-6">
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-7">
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  ones
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 全1 Numpy数组
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 1.  1.]]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-9">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-10">
                 <span class="crayon-v">
                  c
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  full
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 固定值Numpy数组
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  c
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 7.  7.]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-12">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 7.  7.]]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-13">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-14">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  eye
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 2*2 对角Numpy数组
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-15">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 1.  0.]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-16">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 0.  1.]]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-17">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f247f708239289-18">
                 <span class="crayon-v">
                  e
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  random
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  random
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 2*2 的随机Numpy数组
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f247f708239289-19">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  e
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 随机输出
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0250 seconds] -->
         <p>
         </p>
         <h4 id="222-numpy数组索引与取值">
          <p name="t8">
          </p>
          2.2.2 Numpy数组索引与取值
         </h4>
         <p>
          可以通过像list一样的分片/slicing操作取出需要的数值部分。
          <code class="language-python hljs has-numbering">
           <span class="hljs-keyword">
            <br/>
           </span>
          </code>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f248b030889098" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

# 创建如下的3*4 Numpy数组
# [[ 1  2  3  4]
#  [ 5  6  7  8]
#  [ 9 10 11 12]]
a = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])

# 通过slicing取出前两行的2到3列:
# [[2 3]
#  [6 7]]
b = a[:2, 1:3]

# 需要注意的是取出的b中的数据实际上和a的这部分数据是同一份数据.
print a[0, 1]   # Prints "2"
b[0, 0] = 77    # b[0, 0] 和 a[0, 1] 是同一份数据
print a[0, 1]   # a也被修改了，Prints "77"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f248b030889098-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f248b030889098-17">
                 17
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f248b030889098-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-3">
                 <span class="crayon-c">
                  # 创建如下的3*4 Numpy数组
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-4">
                 <span class="crayon-c">
                  # [[ 1  2  3  4]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-5">
                 <span class="crayon-c">
                  #  [ 5  6  7  8]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-6">
                 <span class="crayon-c">
                  #  [ 9 10 11 12]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-7">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  11
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  12
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-8">
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-9">
                 <span class="crayon-c">
                  # 通过slicing取出前两行的2到3列:
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-10">
                 <span class="crayon-c">
                  # [[2 3]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-11">
                 <span class="crayon-c">
                  #  [6 7]]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-12">
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-13">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-14">
                 <span class="crayon-c">
                  # 需要注意的是取出的b中的数据实际上和a的这部分数据是同一份数据.
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-15">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "2"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f248b030889098-16">
                 <span class="crayon-v">
                  b
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  77
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # b[0, 0] 和 a[0, 1] 是同一份数据
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f248b030889098-17">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # a也被修改了，Prints "77"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0132 seconds] -->
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2498387565483" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

a = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])

row_r1 = a[1, :]    # a 的第二行  
row_r2 = a[1:2, :]  # 同上
print row_r1, row_r1.shape  # Prints "[5 6 7 8] (4,)"
print row_r2, row_r2.shape  # Prints "[[5 6 7 8]] (1, 4)"

col_r1 = a[:, 1]
col_r2 = a[:, 1:2]
print col_r1, col_r1.shape  # Prints "[ 2  6 10] (3,)"
print col_r2, col_r2.shape  # Prints "[[ 2]
                            #          [ 6]
                            #          [10]] (3, 1)"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2498387565483-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2498387565483-15">
                 15
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2498387565483-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-3">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  11
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  12
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-5">
                 <span class="crayon-v">
                  row_r1
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # a 的第二行
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-6">
                 <span class="crayon-v">
                  row_r2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 同上
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  row_r1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  row_r1
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  shape
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[5 6 7 8] (4,)"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  row_r2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  row_r2
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  shape
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[5 6 7 8]] (1, 4)"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-9">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-10">
                 <span class="crayon-v">
                  col_r1
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-11">
                 <span class="crayon-v">
                  col_r2
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-12">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  col_r1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  col_r1
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  shape
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[ 2  6 10] (3,)"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-13">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  col_r2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  col_r2
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  shape
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 2]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2498387565483-14">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 6]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2498387565483-15">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [10]] (3, 1)"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0234 seconds] -->
         <p>
          还可以这么着取：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24a8147738374" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

a = np.array([[1,2], [3, 4], [5, 6]])

# 取出(0,0) (1,1) (2,0)三个位置的值
print a[[0, 1, 2], [0, 1, 0]]  # Prints "[1 4 5]"

# 和上面一样
print np.array([a[0, 0], a[1, 1], a[2, 0]])  # Prints "[1 4 5]"

# 取出(0,1) (0,1) 两个位置的值
print a[[0, 0], [1, 1]]  # Prints "[2 2]"

# 同上
print np.array([a[0, 1], a[0, 1]])  # Prints "[2 2]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24a8147738374-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24a8147738374-15">
                 15
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-3">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-5">
                 <span class="crayon-c">
                  # 取出(0,0) (1,1) (2,0)三个位置的值
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[1 4 5]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-7">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-8">
                 <span class="crayon-c">
                  # 和上面一样
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-9">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[1 4 5]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-10">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-11">
                 <span class="crayon-c">
                  # 取出(0,1) (0,1) 两个位置的值
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-12">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[2 2]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-13">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24a8147738374-14">
                 <span class="crayon-c">
                  # 同上
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24a8147738374-15">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[2 2]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0192 seconds] -->
         <p>
         </p>
         <p>
          我们还可以通过条件得到bool型的Numpy数组结果，再通过这个数组取出符合条件的值，如下：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24b2869731558" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

a = np.array([[1,2], [3, 4], [5, 6]])

bool_idx = (a &gt; 2)  # 判定a大于2的结果矩阵

print bool_idx      # Prints "[[False False]
                    #          [ True  True]
                    #          [ True  True]]"

# 再通过bool_idx取出我们要的值
print a[bool_idx]  # Prints "[3 4 5 6]"

# 放在一起我们可以这么写
print a[a &gt; 2]     # Prints "[3 4 5 6]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b2869731558-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b2869731558-15">
                 15
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-3">
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-5">
                 <span class="crayon-v">
                  bool_idx
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 判定a大于2的结果矩阵
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-6">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  bool_idx
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[False False]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-8">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ True  True]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-9">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ True  True]]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-10">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-11">
                 <span class="crayon-c">
                  # 再通过bool_idx取出我们要的值
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-12">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  bool_idx
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[3 4 5 6]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-13">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b2869731558-14">
                 <span class="crayon-c">
                  # 放在一起我们可以这么写
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b2869731558-15">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  a
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  &gt;
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[3 4 5 6]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0216 seconds] -->
         <p>
         </p>
         <h4 id="numpy数组的类型">
          <p name="t9">
          </p>
          Numpy数组的类型
         </h4>
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24b9578628621" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

x = np.array([1, 2])  
print x.dtype         # Prints "int64"

x = np.array([1.0, 2.0]) 
print x.dtype             # Prints "float64"

x = np.array([1, 2], dtype=np.int64)  # 强制使用某个type
print x.dtype                         # Prints "int64"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24b9578628621-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b9578628621-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b9578628621-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b9578628621-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b9578628621-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b9578628621-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b9578628621-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b9578628621-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24b9578628621-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24b9578628621-10">
                 10
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24b9578628621-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b9578628621-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b9578628621-3">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b9578628621-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  dtype
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "int64"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b9578628621-5">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b9578628621-6">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1.0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2.0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b9578628621-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  dtype
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "float64"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b9578628621-8">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24b9578628621-9">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  dtype
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  int64
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 强制使用某个type
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24b9578628621-10">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  dtype
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "int64"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0126 seconds] -->
         <p>
         </p>
         <h4 id="223-numpy数组的运算">
          <p name="t10">
          </p>
          2.2.3 Numpy数组的运算
         </h4>
         <p>
          矩阵的加减开方和(元素对元素)乘除如下：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24c0071934101" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

x = np.array([[1,2],[3,4]], dtype=np.float64)
y = np.array([[5,6],[7,8]], dtype=np.float64)

# [[ 6.0  8.0]
#  [10.0 12.0]]
print x + y
print np.add(x, y)

# [[-4.0 -4.0]
#  [-4.0 -4.0]]
print x - y
print np.subtract(x, y)

# 元素对元素，点对点的乘积
# [[ 5.0 12.0]
#  [21.0 32.0]]
print x * y
print np.multiply(x, y)

# 元素对元素，点对点的除法
# [[ 0.2         0.33333333]
#  [ 0.42857143  0.5       ]]
print x / y
print np.divide(x, y)

# 开方
# [[ 1.          1.41421356]
#  [ 1.73205081  2.        ]]
print np.sqrt(x)
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-17">
                 17
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-18">
                 18
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-19">
                 19
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-20">
                 20
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-21">
                 21
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-22">
                 22
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-23">
                 23
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-24">
                 24
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-25">
                 25
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-26">
                 26
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-27">
                 27
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-28">
                 28
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-29">
                 29
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c0071934101-30">
                 30
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c0071934101-31">
                 31
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-3">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  dtype
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  float64
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-4">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  dtype
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  float64
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-5">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-6">
                 <span class="crayon-c">
                  # [[ 6.0  8.0]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-7">
                 <span class="crayon-c">
                  #  [10.0 12.0]]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  y
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-9">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  add
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-10">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-11">
                 <span class="crayon-c">
                  # [[-4.0 -4.0]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-12">
                 <span class="crayon-c">
                  #  [-4.0 -4.0]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-13">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  -
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  y
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-14">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  subtract
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-15">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-16">
                 <span class="crayon-c">
                  # 元素对元素，点对点的乘积
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-17">
                 <span class="crayon-c">
                  # [[ 5.0 12.0]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-18">
                 <span class="crayon-c">
                  #  [21.0 32.0]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-19">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  y
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-20">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  multiply
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-21">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-22">
                 <span class="crayon-c">
                  # 元素对元素，点对点的除法
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-23">
                 <span class="crayon-c">
                  # [[ 0.2         0.33333333]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-24">
                 <span class="crayon-c">
                  #  [ 0.42857143  0.5       ]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-25">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  /
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  y
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-26">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  divide
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-27">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-28">
                 <span class="crayon-c">
                  # 开方
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-29">
                 <span class="crayon-c">
                  # [[ 1.          1.41421356]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c0071934101-30">
                 <span class="crayon-c">
                  #  [ 1.73205081  2.        ]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c0071934101-31">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  sqrt
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0134 seconds] -->
         <p>
         </p>
         <p>
          矩阵的内积是通过下列方法计算的：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24c8978957727" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

x = np.array([[1,2],[3,4]])
y = np.array([[5,6],[7,8]])

v = np.array([9,10])
w = np.array([11, 12])

# 向量内积，得到 219
print v.dot(w)
print np.dot(v, w)

# 矩阵乘法，得到 [29 67]
print x.dot(v)
print np.dot(x, v)

# 矩阵乘法
# [[19 22]
#  [43 50]]
print x.dot(y)
print np.dot(x, y)
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-17">
                 17
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-18">
                 18
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-19">
                 19
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24c8978957727-20">
                 20
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24c8978957727-21">
                 21
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-3">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-4">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-5">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-6">
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-7">
                 <span class="crayon-k ">
                  w
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  11
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  12
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-8">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-9">
                 <span class="crayon-c">
                  # 向量内积，得到 219
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-10">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  dot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-k ">
                  w
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  dot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  w
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-12">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-13">
                 <span class="crayon-c">
                  # 矩阵乘法，得到 [29 67]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-14">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  dot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-15">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  dot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-16">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-17">
                 <span class="crayon-c">
                  # 矩阵乘法
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-18">
                 <span class="crayon-c">
                  # [[19 22]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-19">
                 <span class="crayon-c">
                  #  [43 50]]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24c8978957727-20">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  dot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24c8978957727-21">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  dot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0130 seconds] -->
         <p>
          特别特别有用的一个操作是，sum/求和(对某个维度)：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24d0299147440" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

x = np.array([[1,2],[3,4]])

print np.sum(x)  # 整个矩阵的和，得到 "10"
print np.sum(x, axis=0)  # 每一列的和 得到 "[4 6]"
print np.sum(x, axis=1)  # 每一行的和 得到 "[3 7]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24d0299147440-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d0299147440-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d0299147440-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d0299147440-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d0299147440-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d0299147440-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d0299147440-7">
                 7
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24d0299147440-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d0299147440-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d0299147440-3">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d0299147440-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d0299147440-5">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  sum
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 整个矩阵的和，得到 "10"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d0299147440-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  sum
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  axis
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 每一列的和 得到 "[4 6]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d0299147440-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  sum
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  axis
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 每一行的和 得到 "[3 7]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0036 seconds] -->
         <p>
          还有一个经常会用到操作是矩阵的转置，在Numpy数组里用.T实现：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24d6059198009" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

x = np.array([[1,2], [3,4]])
print x    # Prints "[[1 2]
           #          [3 4]]"
print x.T  # Prints "[[1 3]
           #          [2 4]]"

# 1*n的Numpy数组，用.T之后其实啥也没做:
v = np.array([1,2,3])
print v    # Prints "[1 2 3]"
print v.T  # Prints "[1 2 3]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24d6059198009-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d6059198009-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d6059198009-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d6059198009-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d6059198009-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d6059198009-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d6059198009-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d6059198009-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d6059198009-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d6059198009-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24d6059198009-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24d6059198009-12">
                 12
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24d6059198009-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d6059198009-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d6059198009-3">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d6059198009-4">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[1 2]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d6059198009-5">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [3 4]]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d6059198009-6">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  T
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[1 3]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d6059198009-7">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [2 4]]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d6059198009-8">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d6059198009-9">
                 <span class="crayon-c">
                  # 1*n的Numpy数组，用.T之后其实啥也没做:
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d6059198009-10">
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24d6059198009-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[1 2 3]"
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24d6059198009-12">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  T
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[1 2 3]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0080 seconds] -->
         <p>
         </p>
         <h4 id="224-broadcasting">
          <p name="t11">
          </p>
          2.2.4 Broadcasting
         </h4>
         <p>
          Numpy还有一个非常牛逼的机制，你想想，如果你现在有一大一小俩矩阵，你想使用小矩阵在大矩阵上做多次操作。额，举个例子好了，假如你想将一个1*n的矩阵，加到m*n的矩阵的每一行上：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24dd142055557" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            #你如果要用for循环实现是酱紫的(下面用y的原因是，你不想改变原来的x)
import numpy as np

x = np.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]])
v = np.array([1, 0, 1])
y = np.empty_like(x)   # 设置一个和x一样维度的Numpy数组y

# 逐行相加
for i in range(4):
    y[i, :] = x[i, :] + v

# 恩，y就是你想要的了
# [[ 2  2  4]
#  [ 5  5  7]
#  [ 8  8 10]
#  [11 11 13]]
print y
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24dd142055557-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24dd142055557-17">
                 17
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-1">
                 <span class="crayon-c">
                  #你如果要用for循环实现是酱紫的(下面用y的原因是，你不想改变原来的x)
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-2">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-3">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-4">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  11
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  12
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-5">
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-6">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  empty_like
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 设置一个和x一样维度的Numpy数组y
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-7">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-8">
                 <span class="crayon-c">
                  # 逐行相加
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-9">
                 <span class="crayon-st">
                  for
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  i
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-st">
                  in
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  range
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-10">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  i
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-v">
                  i
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  :
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-11">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-12">
                 <span class="crayon-c">
                  # 恩，y就是你想要的了
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-13">
                 <span class="crayon-c">
                  # [[ 2  2  4]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-14">
                 <span class="crayon-c">
                  #  [ 5  5  7]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-15">
                 <span class="crayon-c">
                  #  [ 8  8 10]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24dd142055557-16">
                 <span class="crayon-c">
                  #  [11 11 13]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24dd142055557-17">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0112 seconds] -->
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24e5214545284" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            #上一种方法如果for的次数非常多，会很慢，于是我们改进了一下
import numpy as np

x = np.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]])
v = np.array([1, 0, 1])
vv = np.tile(v, (4, 1))  # 变形，重复然后叠起来
print vv                 # Prints "[[1 0 1]
                         #          [1 0 1]
                         #          [1 0 1]
                         #          [1 0 1]]"
y = x + vv  # 相加
print y  # Prints "[[ 2  2  4
         #          [ 5  5  7]
         #          [ 8  8 10]
         #          [11 11 13]]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24e5214545284-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24e5214545284-15">
                 15
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-1">
                 <span class="crayon-c">
                  #上一种方法如果for的次数非常多，会很慢，于是我们改进了一下
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-2">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-3">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-4">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  11
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  12
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-5">
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-6">
                 <span class="crayon-v">
                  vv
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  tile
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 变形，重复然后叠起来
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  vv
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[1 0 1]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-8">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [1 0 1]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-9">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [1 0 1]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-10">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [1 0 1]]"
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-11">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  vv
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 相加
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-12">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 2  2  4
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-13">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 5  5  7]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24e5214545284-14">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 8  8 10]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24e5214545284-15">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [11 11 13]]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0077 seconds] -->
         <p>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24ed803250705" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            #其实因为Numpy的Broadcasting，你可以直接酱紫操作
import numpy as np

x = np.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]])
v = np.array([1, 0, 1])
y = x + v  # 直接加！！！
print y  # Prints "[[ 2  2  4]
         #          [ 5  5  7]
         #          [ 8  8 10]
         #          [11 11 13]]"
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24ed803250705-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24ed803250705-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24ed803250705-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24ed803250705-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24ed803250705-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24ed803250705-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24ed803250705-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24ed803250705-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24ed803250705-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24ed803250705-10">
                 10
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24ed803250705-1">
                 <span class="crayon-c">
                  #其实因为Numpy的Broadcasting，你可以直接酱紫操作
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24ed803250705-2">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24ed803250705-3">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24ed803250705-4">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  7
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  8
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  9
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  10
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  11
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  12
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24ed803250705-5">
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24ed803250705-6">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 直接加！！！
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24ed803250705-7">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # Prints "[[ 2  2  4]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24ed803250705-8">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 5  5  7]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24ed803250705-9">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [ 8  8 10]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24ed803250705-10">
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  #          [11 11 13]]"
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0105 seconds] -->
         <p>
          更多Broadcasting的例子请看下面：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24f4013156164" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np

v = np.array([1,2,3])  # v has shape (3,)
w = np.array([4,5])    # w has shape (2,)
# 首先把v变成一个列向量
# v现在的形状是(3, 1);
# 作用在w上得到的结果形状是(3, 2)，如下
# [[ 4  5]
#  [ 8 10]
#  [12 15]]
print np.reshape(v, (3, 1)) * w

# 逐行相加
x = np.array([[1,2,3], [4,5,6]])
# 得到如下结果:
# [[2 4 6]
#  [5 7 9]]
print x + v

# 先逐行相加再转置，得到以下结果:
# [[ 5  6  7]
#  [ 9 10 11]]
print (x.T + w).T
# 恩，也可以这么做
print x + np.reshape(w, (2, 1))
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-17">
                 17
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-18">
                 18
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-19">
                 19
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-20">
                 20
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-21">
                 21
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-22">
                 22
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-23">
                 23
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24f4013156164-24">
                 24
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24f4013156164-25">
                 25
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-i">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-2">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-3">
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # v has shape (3,)
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-4">
                 <span class="crayon-k ">
                  w
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # w has shape (2,)
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-5">
                 <span class="crayon-c">
                  # 首先把v变成一个列向量
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-6">
                 <span class="crayon-c">
                  # v现在的形状是(3, 1);
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-7">
                 <span class="crayon-c">
                  # 作用在w上得到的结果形状是(3, 2)，如下
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-8">
                 <span class="crayon-c">
                  # [[ 4  5]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-9">
                 <span class="crayon-c">
                  #  [ 8 10]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-10">
                 <span class="crayon-c">
                  #  [12 15]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-11">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  reshape
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  w
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-12">
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-13">
                 <span class="crayon-c">
                  # 逐行相加
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-14">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  4
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  5
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-cn">
                  6
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-15">
                 <span class="crayon-c">
                  # 得到如下结果:
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-16">
                 <span class="crayon-c">
                  # [[2 4 6]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-17">
                 <span class="crayon-c">
                  #  [5 7 9]]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-18">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  v
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-19">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-20">
                 <span class="crayon-c">
                  # 先逐行相加再转置，得到以下结果:
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-21">
                 <span class="crayon-c">
                  # [[ 5  6  7]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-22">
                 <span class="crayon-c">
                  #  [ 9 10 11]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-23">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  T
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-k ">
                  w
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  T
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24f4013156164-24">
                 <span class="crayon-c">
                  # 恩，也可以这么做
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24f4013156164-25">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  +
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  reshape
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-k ">
                  w
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0132 seconds] -->
         <p>
         </p>
         <h3 id="23-scipy">
          <p name="t12">
          </p>
          2.3 SciPy
         </h3>
         <p>
          Numpy提供了一个非常方便操作和计算的高维向量对象，并提供基本的操作方法，而Scipy是在Numpy的基础上，提供很多很多的函数和方法去直接完成你需要的矩阵操作。有兴趣可以浏览
          <a href="http://docs.scipy.org/doc/scipy/reference/index.html">
           Scipy方法索引
          </a>
          查看具体的方法，函数略多，要都记下来有点困难，随用随查吧。
         </p>
         <h4 id="向量距离计算">
          <p name="t13">
          </p>
          向量距离计算
         </h4>
         <p>
          需要特别拎出来说一下的是，向量之间的距离计算，这个Scipy提供了很好的接口
          <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.pdist.html#scipy.spatial.distance.pdist">
           scipy.spatial.distance.pdist
          </a>
          ：
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f24fc121912497" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np
from scipy.spatial.distance import pdist, squareform

# [[0 1]
#  [1 0]
#  [2 0]]
x = np.array([[0, 1], [1, 0], [2, 0]])
print x

# 计算矩阵每一行和每一行之间的欧氏距离
# d[i, j] 是 x[i, :] 和 x[j, :] 之间的距离,
# 结果如下：
# [[ 0.          1.41421356  2.23606798]
#  [ 1.41421356  0.          1.        ]
#  [ 2.23606798  1.          0.        ]]
d = squareform(pdist(x, 'euclidean'))
print d
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f24fc121912497-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f24fc121912497-17">
                 17
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-2">
                 <span class="crayon-st">
                  from
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  scipy
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  spatial
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  distance
                 </span>
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  pdist
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  squareform
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-3">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-4">
                 <span class="crayon-c">
                  # [[0 1]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-5">
                 <span class="crayon-c">
                  #  [1 0]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-6">
                 <span class="crayon-c">
                  #  [2 0]]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-7">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-k ">
                  array
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-8">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-9">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-10">
                 <span class="crayon-c">
                  # 计算矩阵每一行和每一行之间的欧氏距离
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-11">
                 <span class="crayon-c">
                  # d[i, j] 是 x[i, :] 和 x[j, :] 之间的距离,
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-12">
                 <span class="crayon-c">
                  # 结果如下：
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-13">
                 <span class="crayon-c">
                  # [[ 0.          1.41421356  2.23606798]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-14">
                 <span class="crayon-c">
                  #  [ 1.41421356  0.          1.        ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-15">
                 <span class="crayon-c">
                  #  [ 2.23606798  1.          0.        ]]
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f24fc121912497-16">
                 <span class="crayon-v">
                  d
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  squareform
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-e">
                  pdist
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'euclidean'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f24fc121912497-17">
                 <span class="crayon-k ">
                  print
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  d
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0071 seconds] -->
         <p>
         </p>
         <h3 id="24-matplotlib">
          <p name="t14">
          </p>
          2.4 Matplotlib
         </h3>
         <p>
          这是python中的一个作图工具包。如果你熟悉matlab的语法的话，应该会用得挺顺手。可以通过
          <a href="http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot">
           matplotlib.pyplot.plot
          </a>
          了解更多绘图相关的设置和参数。
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2505496841820" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np
import matplotlib.pyplot as plt

# 计算x和对应的sin值作为y
x = np.arange(0, 3 * np.pi, 0.1)
y = np.sin(x)

# 用matplotlib绘出点的变化曲线
plt.plot(x, y)
plt.show()  # 只有调用plt.show()之后才能显示
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2505496841820-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2505496841820-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2505496841820-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2505496841820-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2505496841820-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2505496841820-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2505496841820-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2505496841820-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2505496841820-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2505496841820-10">
                 10
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2505496841820-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2505496841820-2">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  matplotlib
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  pyplot
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  plt
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2505496841820-3">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2505496841820-4">
                 <span class="crayon-c">
                  # 计算x和对应的sin值作为y
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2505496841820-5">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  arange
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  pi
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0.1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2505496841820-6">
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  sin
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2505496841820-7">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2505496841820-8">
                 <span class="crayon-c">
                  # 用matplotlib绘出点的变化曲线
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2505496841820-9">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  plot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2505496841820-10">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  show
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-c">
                  # 只有调用plt.show()之后才能显示
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0035 seconds] -->
         <p>
          结果如下：
          <br/>
          <img src="http://cs231n.github.io/assets/sine.png"/>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f250b258220452" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            # 在一个图中画出2条曲线
import numpy as np
import matplotlib.pyplot as plt

# 计算x对应的sin和cos值
x = np.arange(0, 3 * np.pi, 0.1)
y_sin = np.sin(x)
y_cos = np.cos(x)

# 用matplotlib作图
plt.plot(x, y_sin)
plt.plot(x, y_cos)
plt.xlabel('x axis label')
plt.ylabel('y axis label')
plt.title('Sine and Cosine')
plt.legend(['Sine', 'Cosine'])
plt.show()
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f250b258220452-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f250b258220452-17">
                 17
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f250b258220452-1">
                 <span class="crayon-c">
                  # 在一个图中画出2条曲线
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-2">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  np
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-3">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  matplotlib
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  pyplot
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  plt
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-5">
                 <span class="crayon-c">
                  # 计算x对应的sin和cos值
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-6">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  arange
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  pi
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0.1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-7">
                 <span class="crayon-v">
                  y_sin
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  sin
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-8">
                 <span class="crayon-v">
                  y_cos
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  cos
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-9">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-10">
                 <span class="crayon-c">
                  # 用matplotlib作图
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-11">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  plot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y_sin
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-12">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  plot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y_cos
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-13">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  xlabel
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'x axis label'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-14">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  ylabel
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'y axis label'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-15">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  title
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'Sine and Cosine'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f250b258220452-16">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  legend
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-s">
                  'Sine'
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-s">
                  'Cosine'
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f250b258220452-17">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  show
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0115 seconds] -->
         <p>
          <img src="http://cs231n.github.io/assets/sine_cosine.png"/>
          <code class="language-python hljs has-numbering">
          </code>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2511155485760" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            # 用subplot分到子图里
import numpy as np
import matplotlib.pyplot as plt

# 得到x对应的sin和cos值
x = np.arange(0, 3 * np.pi, 0.1)
y_sin = np.sin(x)
y_cos = np.cos(x)

# 2*1个子图，第一个位置.
plt.subplot(2, 1, 1)

# 画第一个子图
plt.plot(x, y_sin)
plt.title('Sine')

# 画第2个子图
plt.subplot(2, 1, 2)
plt.plot(x, y_cos)
plt.title('Cosine')

plt.show()
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-16">
                 16
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-17">
                 17
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-18">
                 18
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-19">
                 19
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-20">
                 20
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2511155485760-21">
                 21
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2511155485760-22">
                 22
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2511155485760-1">
                 <span class="crayon-c">
                  # 用subplot分到子图里
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-2">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  np
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-3">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  matplotlib
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  pyplot
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  plt
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-5">
                 <span class="crayon-c">
                  # 得到x对应的sin和cos值
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-6">
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  arange
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  0
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  3
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-v">
                  pi
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0.1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-7">
                 <span class="crayon-v">
                  y_sin
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  sin
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-8">
                 <span class="crayon-v">
                  y_cos
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  cos
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-9">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-10">
                 <span class="crayon-c">
                  # 2*1个子图，第一个位置.
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-11">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  subplot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-12">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-13">
                 <span class="crayon-c">
                  # 画第一个子图
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-14">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  plot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y_sin
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-15">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  title
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'Sine'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-16">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-17">
                 <span class="crayon-c">
                  # 画第2个子图
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-18">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  subplot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-19">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  plot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  x
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  y_cos
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-20">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  title
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  'Cosine'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2511155485760-21">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2511155485760-22">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  show
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0085 seconds] -->
         <p>
          <img src="http://cs231n.github.io/assets/sine_cosine_subplot.png"/>
         </p>
         <h3 id="25-简单图片读写">
          <p name="t15">
          </p>
          2.5 简单图片读写
         </h3>
         <p>
          可以使用
          <code>
           imshow
          </code>
          来显示图片。
          <code class="language-python hljs has-numbering">
          </code>
         </p>
         <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
         <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b86f2517426318003" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
          <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <span class="crayon-title">
           </span>
           <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-wrap-button" title="切换自动换行">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-expand-button" title="点击展开代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-copy-button" title="复制代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
             <div class="crayon-button-icon">
             </div>
            </div>
            <span class="crayon-language">
             Python
            </span>
           </div>
          </div>
          <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
          </div>
          <div class="crayon-plain-wrap">
           <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
            import numpy as np
from scipy.misc import imread, imresize
import matplotlib.pyplot as plt

img = imread('/Users/HanXiaoyang/Comuter_vision/computer_vision.jpg')
img_tinted = img * [1, 0.95, 0.9]

# 显示原始图片
plt.subplot(1, 2, 1)
plt.imshow(img)

# 显示调色后的图片
plt.subplot(1, 2, 2)
plt.imshow(np.uint8(img_tinted))

plt.show()
           </textarea>
          </div>
          <div class="crayon-main" style="">
           <table class="crayon-table">
            <tbody>
             <tr class="crayon-row">
              <td class="crayon-nums " data-settings="show">
               <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-1">
                 1
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-2">
                 2
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-3">
                 3
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-4">
                 4
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-5">
                 5
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-6">
                 6
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-7">
                 7
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-8">
                 8
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-9">
                 9
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-10">
                 10
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-11">
                 11
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-12">
                 12
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-13">
                 13
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-14">
                 14
                </div>
                <div class="crayon-num" data-line="crayon-57686b86f2517426318003-15">
                 15
                </div>
                <div class="crayon-num crayon-striped-num" data-line="crayon-57686b86f2517426318003-16">
                 16
                </div>
               </div>
              </td>
              <td class="crayon-code">
               <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                <div class="crayon-line" id="crayon-57686b86f2517426318003-1">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  numpy
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  np
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-2">
                 <span class="crayon-st">
                  from
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  scipy
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  misc
                 </span>
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  imread
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  imresize
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-3">
                 <span class="crayon-r">
                  import
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  matplotlib
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  pyplot
                 </span>
                 <span class="crayon-st">
                  as
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  plt
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-4">
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-5">
                 <span class="crayon-v">
                  img
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-e">
                  imread
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-s">
                  '/Users/HanXiaoyang/Comuter_vision/computer_vision.jpg'
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-6">
                 <span class="crayon-v">
                  img_tinted
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  =
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-v">
                  img
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-o">
                  *
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-sy">
                  [
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0.95
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  0.9
                 </span>
                 <span class="crayon-sy">
                  ]
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-7">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-8">
                 <span class="crayon-c">
                  # 显示原始图片
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-9">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  subplot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-10">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  imshow
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  img
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-11">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-12">
                 <span class="crayon-c">
                  # 显示调色后的图片
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-13">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  subplot
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-cn">
                  1
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  ,
                 </span>
                 <span class="crayon-h">
                 </span>
                 <span class="crayon-cn">
                  2
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-14">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  imshow
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  np
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  uint8
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-v">
                  img_tinted
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
                <div class="crayon-line" id="crayon-57686b86f2517426318003-15">
                </div>
                <div class="crayon-line crayon-striped-line" id="crayon-57686b86f2517426318003-16">
                 <span class="crayon-v">
                  plt
                 </span>
                 <span class="crayon-sy">
                  .
                 </span>
                 <span class="crayon-e">
                  show
                 </span>
                 <span class="crayon-sy">
                  (
                 </span>
                 <span class="crayon-sy">
                  )
                 </span>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
         <!-- [Format Time: 0.0120 seconds] -->
         <p>
          <img src="http://7xo0y8.com1.z0.glb.clouddn.com/3_computer_vision/computer_vision.png?imageView/2/w/700/q/100"/>
         </p>
        </div>
       </div>
       <div class="bdsharebuttonbox tracking-ad bdshare-button-style0-16" data-bd-bind="1454479600787" data-mod="popu_172">
       </div>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24663.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/095356be8cb4z9ke9389kd-204x200.jpeg"/>
        </a>
        <a class="link" href="http://dataunion.org/24663.html" rel="bookmark" title="人工智能界最强大脑畅谈AI未来之路">
         人工智能界最强大脑畅谈AI未来之路
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24652.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/02/20150522141422337-265x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24652.html" rel="bookmark" title="重磅 | MIT与谷歌专家合著论文：机器学习和神经科学的相互启发与融合（附论文）">
         重磅 | MIT与谷歌专家合著论文：机器学习和神经科学的相互启发与融合（附论文）
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24616.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/224806wllbe6tcimyyi9xt-300x167.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24616.html" rel="bookmark" title="微软人工智能计划背后的华人力量">
         微软人工智能计划背后的华人力量
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24562.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/8aac7ceb921d1684f06e6f65e2c1f224-300x173.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24562.html" rel="bookmark" title="各位大佬，别再拿人工智能当春药了！">
         各位大佬，别再拿人工智能当春药了！
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F21801.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/21801.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/21801.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>